{extend name='common/common' /}

{block name="style"}
<link href="__JS__/plugins/bootstrap-tagsinput/bootstrap-tagsinput.css" rel="stylesheet">
{/block}
{block name="style"}
<style>
    .layui-form-label{
        width: 20px;
    }
</style>
{/block}
{block name="content"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-10">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>添加追踪信息</h5>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal m-t" id="commentForm" method="post" action="{:url('member/addTrack')}">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">客户ID：</label>
                            <div class="input-group col-sm-7">
                                <input id="m_id" type="text" class="form-control" name="m_id" required="" aria-required="true" value="<?=$mid;?>" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">姓名：</label>
                            <div class="input-group col-sm-7">
                                <input id="memberN" type="text" class="form-control" name="memberN" required="" aria-required="true" value="<?=$Mname;?>" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">跟踪方式：</label>
                            <div class="input-group col-sm-7">
                                <select class="form-control" name="type" id="type">
                                    <option value="0">请选择</option>
                                    <option value="1">电话</option>
                                    <option value="2">QQ</option>
                                    <option value="3">微信</option>
                                    <option value="4">邮件</option>
                                    <option value="5">面谈</option>
                                    <option value="6">其他</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">咨询师：</label>
                            <div class="input-group col-sm-7">
                                <input id="username" class="form-control" name="username" value="<?=$Uname;?>" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">录入时间：</label>
                            <div class="input-group col-sm-7">
                                <div class="layui-inline">
                                    <div class="layui-input-inline">
                                        <input type="text" class="layui-input" name="years" id="years" readonly>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"></label>
                                    <div class="layui-input-inline">
                                        <input type="text" class="layui-input" name="times" id="times" readonly>
                                    </div>
                                </div>
                                <!--<input id="time" class="form-control" name="time">-->
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">跟踪备注：</label>
                            <div class="input-group col-sm-7">
                                <textarea name="content" id="content" class="form-control" cols="30" rows="10"></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-5 col-sm-offset-7" style="padding-left: 6%">
                                <button class="btn btn-primary" type="submit" style="margin-right: 25px">确认提交</button>
                                <a  href="javascript:;" onClick="javascript :history.back(-1);">
                                    <button type="button" class="btn btn-primary btn-sm" style="width: 82px;height: 34px;">
                                        返回
                                    </button>
                                </a>
                                <!--<input type="button" value="提交" class="btn btn-primary" id="postform"/>-->
                            </div>
                        </div>
                    </form>
                </div>
            </div>

        </div>
    </div>
</div>
{/block}


{block name="script"}
<script src="__JS__/jquery.min.js?v=2.1.4"></script>
<script src="__JS__/bootstrap.min.js?v=3.3.6"></script>
<script src="__JS__/content.min.js?v=1.0.0"></script>
<script src="__JS__/plugins/bootstrap-tagsinput/bootstrap-tagsinput.min.js"></script>
<script src="__JS__/plugins/validate/jquery.validate.min.js"></script>
<script src="__JS__/plugins/validate/messages_zh.min.js"></script>
<script src="__JS__/layui/layui.js"></script>
<script src="__JS__/jquery.form.js"></script>

<script type="text/javascript">
    //时间选择
    layui.use('laydate', function() {
        var laydate = layui.laydate;

        //常规用法
        laydate.render({
            elem: '#years'
        });


        //时间选择器
        laydate.render({
            elem: '#times'
            , type: 'time'
        });

    })



    var index = '';
    function showStart(){
        index = layer.load(0, {shade: false});
        return true;
    }

    function showSuccess(res){
        layer.ready(function(){
            layer.close(index);
            if(1 == res.code){
                layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
                    window.location.href = res.data;
                });
            }else if(111 == res.code){
                window.location.reload();
            }else{
                layer.msg(res.msg, {anim: 6});
            }
        });
    }

    $(document).ready(function(){
        // 添加角色
        var options = {
            beforeSubmit:showStart,
            success:showSuccess
        };

        $('#commentForm').submit(function(){
            $(this).ajaxSubmit(options);
            return false;
        });

//        $('#adress').tagsinput('add', 'some tag');
//        $(".bootstrap-tagsinput").addClass('col-sm-12').find('input').addClass('form-control')
//                .attr('placeholder', '输入后按enter');
//        var editor = UE.getEditor('container');
    });

    // 表单验证
    $.validator.setDefaults({
        highlight: function(e) {
            $(e).closest(".form-group").removeClass("has-success").addClass("has-error")
        },
        success: function(e) {
            e.closest(".form-group").removeClass("has-error").addClass("has-success")
        },
        errorElement: "span",
        errorPlacement: function(e, r) {
            e.appendTo(r.is(":radio") || r.is(":checkbox") ? r.parent().parent().parent() : r.parent())
        },
        errorClass: "help-block m-b-none",
        validClass: "help-block m-b-none"
    });
</script>
{/block}
